<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>物流接口列表</h2>
	</div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
        <th class="">使用</th>
		<th class="">代号</th>
		<th class="">物流接口名称</th>
		<th class="">官网</th>
		<th class="">备注</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
			<td><eq name="vo.installed" value="1"><input type="radio" name="in_used" value="{$vo.code}" <eq name="vo.in_used" value="1">checked</eq> /></eq></td>
			<td>{$vo.code} </td>
			<td>{$vo.title}</td>
			<td><a href="{$vo.website}" target="_blank">{$vo.website}</a></td>
			<td>{$vo.desc}</td>
			<td><eq name="vo.installed" value="1">
				<a href="{:U('Shipping/uninstall', array('code'=>$vo['code']))}" class="confirm ajax-get" title="卸载">卸载</a>
				<a href="{:U('Shipping/editApi', array('code'=>$vo['code']))}">编辑</a>
				<else/>
				<a href="{:U('Shipping/install', array('code'=>$vo['code']))}" class="ajax-get" title="安装">安装</a>
				</eq></td>
		</tr>
		</volist>
		<else/>
		<td colspan="5" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
<script type="text/javascript">
$(function(){
    //导航高亮
    highlight_subnav('{:U('Shipping/api')}');
    
    $('input[name="in_used"]').change(function(){
    	paramter = {code: $(this).val()};
    	
    	$.post('{:U('Shipping/used')}', paramter, function(data){
			if (data.status == 1) {
				updateAlert(data.message, "alert-success");
                setTimeout(function(){
                	$('#top-alert').find('button').click();
                },1500);
			} else {
				updateAlert(data.message);
                setTimeout(function(){
                	$('#top-alert').find('button').click();
                },1500);
			}
		}, 'json');
    });
})
</script>
</block>
